<template>
    <div>
        <p>
            <!--刷新按钮-->
            <button v-on:click="getList(1)" class="btn btn-white btn-default btn-round">
                <i class="ace-icon fa fa-refresh"></i>
                刷新
            </button>
        </p>
        <!--pagination可选参数：v-bind:itemCount="8" 不设置默认显示5个按钮，设置最多显示8个按钮-->
        <pagination ref="pagination" v-bind:list="getList"></pagination>

        <table id="simple-table" class="table  table-bordered table-hover">
                <thead>
                <tr>
                                    <th>手机号</th>
                    <th>密码</th>
                    <th>昵称</th>
                    <th>头像url</th>
                    <th>注册时间</th>
                </tr>
                </thead>

                <tbody>

                <tr v-for="member in members">
                    <td>{{member.mobile}}</td>
                    <td>{{member.password}}</td>
                    <td>{{member.name}}</td>
                    <td>{{member.photo}}</td>
                    <td>{{member.registerTime}}</td>
                </tr>
            </tbody>
        </table>

    </div>
</template>

<script>
    import Pagination from "../../components/pagination";
    export default {
        components: {Pagination},
        name: "business-member",
        data: function() {
            return {
                member: {},
                members: [],
            }
        },
        mounted: function() {
            // sidebar激活样式方法一
            // this.$parent.activeSidebar("business-member-sidebar");
            let _this = this;
            _this.$refs.pagination.size = 10;
            _this.getList(1);
        },
        methods: {

            /**
             * 列表查询
             */
            getList: function (page) {
                let _this = this;
                Loading.show();
                _this.$ajax.post(process.env.VUE_APP_SERVER + '/business/admin/member/list',{
                    page: page,
                    size: _this.$refs.pagination.size,
                }).then((response)=>{
                    Loading.hide();
                    let resp = response.data;
                    _this.members = resp.content.list;
                    _this.$refs.pagination.render(page, resp.content.total);

                })

            },
        }
    }
</script>